const util = require('../../utils/util.js');
Page({

  /**
   * 页面的初始数据
   */
  data: {
    active: '0',
    serviceOrdersBos: [],
    loading:false,
    showpopup:false,
    rateValue:0,
    valuedd:''
  },
  handleShowpopup(){
    this.setData({
      showpopup:true
    })
  },
  rateOnChange(event) {
    this.setData({
      rateValue: event.detail,
    });
  },
  handleSubmit(){},
  rateOnClose(){
    this.setData({
      showpopup:false
    })
  },
  doItem(e){
    const data = e.currentTarget.dataset;
    console.log(data)
    wx.setStorageSync('fuwudetail', data.item)
    wx.navigateGo({
      url: '/page5/fuwudetail/index',
    })
  },
  onChange(e) {
    console.log(e.detail)
    console.log('onChange')
    this.setData({
      active: e.detail.name
    })
    this.getInit();
  },
  getInit() {
    this.setData({
      serviceOrdersBos: [],
      loading:true
    })
    const data = this.data;
    util.https('serverOrder/serverOrderListQry', {
      orderState: data.active != '0' ? data.active : ''
    }, (res) => {
      console.log(res)
      this.setData({
        loading:false,
        serviceOrdersBos: res.serviceOrdersBos
      })
    }, (res) => {
      console.log(res)
      this.setData({
        loading:false
      })
      wx.showModal({
        title: '温馨提示',
        content: res.errorMsg,
        confirmColor: '#F08302',
        showCancel: false,
        success(res) {
        }
      })

    })
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {
    const ac = wx.getStorageSync('page5fuwutab');
    this.setData({
      active:ac
    })
    this.getInit();
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  }
  
})